// Recent Post widget for Blogger
// Author: yOu w4hyOu
// https://plus.google.com/106933633716411881896/about

function recentPosts(a) {
    if (document.getElementById("recent-posts")) {
        var e = a.feed.entry,
            title, link, content = "",
            ct = document.getElementById("recent-posts");
        for (var i = 0; i < numPosts; i++) {
            for (var j = 0; j < numPosts; j++) {
                if (e[i].link[j].rel == "alternate") {
                    link = e[i].link[j].href;
                    break
                }
            }
            var title = e[i].title.$t,
                postAuthor = e[i].author[0].name.$t,
                pd = e[i].published.$t.substring(0, 10).split("-"),
                o = ["Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"];
            content += '<li class="recent-posts"><strong><a href="' + link + '" title="' + title + '" target="_blank">' + title + '</a></strong>';
            content += '<span class="author"><time datetime=' + pd.join("-") + '>' + (pd[2] + " " + o[(parseInt(pd[1], 10) - 1)] + " " + pd[0]) + '</time> | <span>' + postAuthor + '</span></span></li>'
        }
        ct.innerHTML = content
    }
}
var you_script = document.createElement('script');
you_script.src = homePage + '/feeds/posts/summary?alt=json-in-script&orderby=published&max-results=' + numPosts + '&callback=recentPosts';
document.getElementsByTagName('head')[0].appendChild(you_script);